<!--
 * @Description: 
 * @Version: 2.0
 * @Autor: Seven
 * @Date: 2023-11-02 10:44:06
 * @LastEditors: Seven
 * @LastEditTime: 2023-11-02 13:40:12
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <style>
    html,
    body {
      width: 100%;
      height: 100%;
      display: flex;
    }
    ul,
    li {
      list-style: none;
    }
    .g-container {
      position: relative;
      width: 300px;
      margin: auto;
      padding: 5px;
      overflow: hidden;
    }
    .g-container::before {
      position: absolute;
      right: 0;
      top: 0;
      bottom: 0;
      content: "";
      width: 100px;
      background: linear-gradient(90deg, transparent, #fff);
      pointer-events: none;
    }
    .g-container .list {
      width: 300px;
      /* 这里不设置宽度的话是由里面的内容决定，需要设置宽度 */
      display: flex;
      flex-wrap: nowrap;
      overflow-x: scroll;
    }
    .g-container .list li {
      margin-right: 12px;
      border-radius: 5px;
      border: 1px solid #666;
      padding: 4px;
      cursor: pointer;
    }
    .g-container .list li:hover {
      background: #666;
      color: #fff;
    }
    ::-webkit-scrollbar {
      display: none;
    }
  </style>
  <body>
    <div class="g-container">
      <ul class="list">
        <li>Button</li>
        <li>Button</li>
        <li>Button</li>
        <li>Button</li>
        <li>Button</li>
        <li>Button</li>
      </ul>
    </div>
  </body>
</html>
